/**
 *  iBizSys 5.0 机器人生产代码（不要直接修改当前代码）
 *  http://www.ibizsys.net
 */
package com.sa.litetwo.app.srv.common.ctrlmodel;


import java.util.ArrayList;
import java.util.List;
import net.ibizsys.paas.util.StringHelper;
import net.ibizsys.paas.web.AjaxActionResult;
import net.ibizsys.paas.web.WebContext;
import net.ibizsys.paas.util.GlobalContext;
import net.ibizsys.paas.core.IDEDataSetCond;
import net.ibizsys.paas.core.DEDataSetCond;
import net.ibizsys.paas.core.DEDataSetFetchContext;
import net.ibizsys.paas.db.DBFetchResult;
import net.ibizsys.paas.web.WebContext;
import net.ibizsys.paas.util.DataTypeHelper;
import net.ibizsys.paas.data.IDataObject;
import net.ibizsys.paas.datamodel.DataItemModel;
import net.ibizsys.paas.datamodel.DataItemParamModel;
import net.ibizsys.paas.entity.EntityFieldError;
import net.ibizsys.paas.entity.EntityError;
import net.ibizsys.paas.demodel.IDataEntityModel;
import net.ibizsys.paas.demodel.DEModelGlobal;

import net.ibizsys.paas.control.form.FormError;
import net.ibizsys.paas.control.form.IFormItem;
import net.ibizsys.paas.control.form.FormItemError;
import net.ibizsys.paas.ctrlmodel.EditFormItemModel;
import net.ibizsys.paas.data.IDataObject;
import net.ibizsys.paas.entity.EntityError;
import net.ibizsys.paas.entity.IEntity;
import net.ibizsys.paas.service.IService;

/**
 * 实体[代码项]编辑表单[form]部件模型
 */
public class CodeItemMain2EditFormModel extends net.ibizsys.paas.ctrlmodel.EditFormModelBase{
   
    public CodeItemMain2EditFormModel()  {
        super();
        this.setName("form");      
    }

      private net.ibizsys.psrt.srv.common.demodel.CodeItemDEModel codeItemDEModel;
     protected  net.ibizsys.psrt.srv.common.demodel.CodeItemDEModel getCodeItemDEModel() {
            if(this.codeItemDEModel==null){
                try
                {
                     this.codeItemDEModel = (net.ibizsys.psrt.srv.common.demodel.CodeItemDEModel)DEModelGlobal.getDEModel("net.ibizsys.psrt.srv.common.demodel.CodeItemDEModel");
                }
                catch(Exception ex)
                {
                }
            }
           return this.codeItemDEModel;
      }

      @Override
      public IDataEntityModel getDEModel() {
          return this.getCodeItemDEModel();
      }

    /**
     * 准备表单项模型
     * @throws Exception
     */
    protected void prepareFormItems()throws Exception
    {
    	super.prepareFormItems();
    	IFormItem iFormItem = null;
        // srfupdatedate 
		iFormItem = this.createFormItem("srfupdatedate");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("srfupdatedate");
			formItem.setDEFName("UPDATEDATE");
			formItem.setCaption("更新时间");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("srfupdatedate");
	        dataItem.setDataType(5);
	        dataItem.setFormat("%1$s");
	        //注册参数
	        DataItemParamModel dataItemParam0 = new DataItemParamModel();
	        dataItemParam0.setName("UPDATEDATE");
	        dataItemParam0.setFormat("%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS");
	        dataItem.addDataItemParam(dataItemParam0);
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // srforikey 
		iFormItem = this.createFormItem("srforikey");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("srforikey");
			formItem.setDEFName("");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("srforikey");
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // srfkey 
		iFormItem = this.createFormItem("srfkey");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("srfkey");
			formItem.setDEFName("CODEITEMID");
			formItem.setCaption("代码项标识");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("srfkey");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
	        //注册参数
	        DataItemParamModel dataItemParam0 = new DataItemParamModel();
	        dataItemParam0.setName("CODEITEMID");
	        dataItemParam0.setFormat("%1$s");
	        dataItem.addDataItemParam(dataItemParam0);
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // srfmajortext 
		iFormItem = this.createFormItem("srfmajortext");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("srfmajortext");
			formItem.setDEFName("CODEITEMNAME");
			formItem.setCaption("代码项名称");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("srfmajortext");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
	        //注册参数
	        DataItemParamModel dataItemParam0 = new DataItemParamModel();
	        dataItemParam0.setName("CODEITEMNAME");
	        dataItemParam0.setFormat("%1$s");
	        dataItem.addDataItemParam(dataItemParam0);
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // srftempmode 
		iFormItem = this.createFormItem("srftempmode");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("srftempmode");
			formItem.setDEFName("");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("srftempmode");
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // srfuf 
		iFormItem = this.createFormItem("srfuf");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("srfuf");
			formItem.setDEFName("");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("srfuf");
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // srfdeid 
		iFormItem = this.createFormItem("srfdeid");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("srfdeid");
			formItem.setDEFName("");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("srfdeid");
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // srfsourcekey 
		iFormItem = this.createFormItem("srfsourcekey");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("srfsourcekey");
			formItem.setDEFName("");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("srfsourcekey");
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // codelistname 
		iFormItem = this.createFormItem("codelistname");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("codelistname");
			formItem.setDEFName("CODELISTNAME");
			formItem.setEnableCond(1);
			formItem.setCaption("代码表");
			formItem.setAllowEmpty(false);

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("codelistname");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // pcodeitemname 
		iFormItem = this.createFormItem("pcodeitemname");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("pcodeitemname");
			formItem.setDEFName("PCODEITEMNAME");
			formItem.setCaption("上级代码项");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("pcodeitemname");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // codeitemname 
		iFormItem = this.createFormItem("codeitemname");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("codeitemname");
			formItem.setDEFName("CODEITEMNAME");
			formItem.setCaption("代码项名称");
			formItem.setAllowEmpty(false);

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("codeitemname");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // codeitemvalue 
		iFormItem = this.createFormItem("codeitemvalue");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("codeitemvalue");
			formItem.setDEFName("CODEITEMVALUE");
			formItem.setCaption("代码项值");
			formItem.setAllowEmpty(false);

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("codeitemvalue");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // ordervalue 
		iFormItem = this.createFormItem("ordervalue");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("ordervalue");
			formItem.setDEFName("ORDERVALUE");
			formItem.setCaption("排序值");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("ordervalue");
	        dataItem.setDataType(9);
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // shortkey 
		iFormItem = this.createFormItem("shortkey");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("shortkey");
			formItem.setDEFName("SHORTKEY");
			formItem.setCaption("快捷输入");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("shortkey");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // memo 
		iFormItem = this.createFormItem("memo");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("memo");
			formItem.setDEFName("MEMO");
			formItem.setCaption("备注");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("memo");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // createman 
		iFormItem = this.createFormItem("createman");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("createman");
			formItem.setDEFName("CREATEMAN");
			formItem.setIgnoreInput(3);
			formItem.setCodeListId("com.sa.litetwo.srv.codelist.SysOperatorCodeListModel");
			formItem.setCaption("建立人");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("createman");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
			dataItem.setCodeListId("com.sa.litetwo.srv.codelist.SysOperatorCodeListModel");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // createdate 
		iFormItem = this.createFormItem("createdate");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("createdate");
			formItem.setDEFName("CREATEDATE");
			formItem.setCaption("建立时间");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("createdate");
	        dataItem.setDataType(5);
	        dataItem.setFormat("%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // updateman 
		iFormItem = this.createFormItem("updateman");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("updateman");
			formItem.setDEFName("UPDATEMAN");
			formItem.setIgnoreInput(3);
			formItem.setCodeListId("com.sa.litetwo.srv.codelist.SysOperatorCodeListModel");
			formItem.setCaption("更新人");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("updateman");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
			dataItem.setCodeListId("com.sa.litetwo.srv.codelist.SysOperatorCodeListModel");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // updatedate 
		iFormItem = this.createFormItem("updatedate");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("updatedate");
			formItem.setDEFName("UPDATEDATE");
			formItem.setCaption("更新时间");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("updatedate");
	        dataItem.setDataType(5);
	        dataItem.setFormat("%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // codeitemid 
		iFormItem = this.createFormItem("codeitemid");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("codeitemid");
			formItem.setDEFName("CODEITEMID");
			formItem.setCaption("代码项标识");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("codeitemid");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // pcodeitemid 
		iFormItem = this.createFormItem("pcodeitemid");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("pcodeitemid");
			formItem.setDEFName("PCODEITEMID");
			formItem.setCaption("上级代码项");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("pcodeitemid");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        // codelistid 
		iFormItem = this.createFormItem("codelistid");
		if(iFormItem==null)
		{
			EditFormItemModel formItem = new EditFormItemModel();
			formItem.setForm(this);
			formItem.setName("codelistid");
			formItem.setDEFName("CODELISTID");
			formItem.setEnableCond(1);
			formItem.setCaption("代码表");

			//设置数据项参数
			DataItemModel dataItem = new DataItemModel(); 
			dataItem.setName("codelistid");
	        dataItem.setDataType(25);
	        dataItem.setFormat("%1$s");
			formItem.setDataItem(dataItem);
			formItem.init();
			iFormItem = formItem;
		}
		this.registerFormItem(iFormItem);
        	
    }
    
    /**
     * 填充表单值
     * @param iDataObject
     * @param bUpdate
     * @param bIgnoreEmpty
     * @param formError
     * @throws Exception
     */
    @Override
    protected void onFillInputValues(IDataObject iDataObject,boolean bUpdate,boolean bIgnoreEmpty,FormError formError)throws Exception
    {
    	  super.onFillInputValues(iDataObject,bUpdate,bIgnoreEmpty,formError);
          if(formError.hasError())
              return;

 
    }
    @Override
    protected void onTestValueRule(IService iService, IDataObject iDataObject, boolean bUpdate,EntityError entityError) throws Exception
	{
		EntityFieldError entityFieldError = null;
		super.onTestValueRule( iService,  iDataObject,  bUpdate, entityError) ;
	}
}